﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;

namespace FantastPlatform.Framework.Common.Configration
{
    public static class WCFServiceClientFactory<TServiceClient, TService>
        where TServiceClient : ClientBase<TService>, TService
        where TService : class
    {
        //public static TServiceClient CreateServiceClient()
        //{
        //  var typeName=typeof(TService).Name;
        //  var serviceAddress="../"+typeName+".svc";
        //  return CreateServiceClient(serviceAddress);
        //}
        //public static TServiceClient CreateServiceClient(string serviceAddress)
        //{
        //  var endpointAddr=new EndpointAddress(new Uri(Application.Current.Host.Source,serviceAddress));
        //  var binding=new BasicHttpBinding();
        //  var ctor=typeof(TServiceClient).GetConstructor(new Type[]{typeof(Binding),typeof(EndpointAddress)});
        //  return(TServiceClient)ctor.Invoke(new object[]{binding,endpointAddr});
        //}
    }
}

